﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using L = Science.Mathematics.LinearAlgebra;

namespace Strang3Ed.Chapter02.Section2
{
    public class ExampleB
    {
        public ExampleB()
        {
        }
        private string result;
        public string Result
        {
            get { return result; }
        }
        public void Compute()
        {
            double[,] x = {{1.0,1.0,1.0},
                           {1.0,1.0,-1.0},
                           {-1.0,-1.0,1.0}};  // 1.0 -> -1.0
            double[] y = {7.0,5.0,3.0};
            L.Matrix A = new L.Matrix(x);
            L.Vector b = new L.Vector(y);
            L.LinearEquation obj = new L.LinearEquation(A,b);
            obj.Solve();

            result += obj.Solution[0].ToString() + "    ";
            result += obj.Solution[1].ToString() + "    ";
            result += obj.Solution[2].ToString() + "\r\n";           
        }
    }
}
/*
4    2    1
13    -2    4  // wrong answer since A is not invertible.
*/